/*--------------------------------------------------------------
 * File: data.h 编码类型：C语言  UTF-8
 * Author WRS (1352509846@qq.com)
 * 功能: 数据生成功能
 * Version 0.1
 * Date 2024-04-26 
 * 
 * @copyright Copyright (c) 2024
 * 
----------------------------------------------------------------*/

#ifndef __DATA_H
#define	__DATA_H

#ifdef __cplusplus
extern "C" {
#endif
#include "stdio.h"
#include "stdint.h"

#define DEV_INFO_NAMESPACE "devinfoNS"  // 设备信息命名空间

#define BML04_key   "BML04key"
#define BML12_key   "BML12key"
#define MA8_key     "MA8key"
#define MD8_key     "MD8key"
#define M38_key     "M38key"
#define M26_key     "M26key"
#define MLD6_key    "MLD6key"

void json_test(void);
void Random_Seed_Init(void);
int Random_data_in_range(int min, int max);
int Linear_data_in_range(int min, int max, int incdata);
double Random_data_in_sin(double amplitude, double frequency, double phase_shift);
int Random_data_fixed(int value);
int Random_data_outside(uint8_t type);

void NVS_data_init(void);
size_t      NVS_data_read_str(const char* namespace, const char* key, char* value, int maxlen);
esp_err_t   NVS_data_write_str(const char* namespace,const char* key,const char* value);
size_t      NVS_data_read_blob(const char* namespace, const char* key, uint8_t *value, int maxlen);
esp_err_t   NVS_data_write_blob(const char* namespace, const char* key, uint8_t* value, size_t len);
esp_err_t   NVS_data_erase_key(const char* namespace,const char* key);

void SD_Conf_init(char *sd_conf_file);

#ifdef __cplusplus
}
#endif


#endif